package com.myrpc.util;

import lombok.extern.slf4j.Slf4j;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
@Slf4j
public class PropertiesUtil {
    public static String getConfigProperty(String key){
        InputStream stream = PropertiesUtil.class.getClassLoader().getResourceAsStream("config.properties");
        Properties properties = new Properties();
        try {
            properties.load(stream);
        } catch (IOException e) {
            log.error("加载配置文件时IO异常",e);
            throw new RuntimeException(e);
        }
        return (String) properties.get(key);
    }
}
